<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui" xml:lang="en" lang="en">
	<h:head />
	<body>
		<ui:composition template="/rootWeb.xhtml">
	    <ui:define name="header">
	        <title>铝价管理</title>
	        <script type="text/javascript">
				//页面载入时注册
	        	jQuery(document).ready(function(){
	        		//鼠标移入
					jQuery("#alpriceListTable_data tr").live("mouseover", function() {
					  	jQuery(this).css("background-color","#CCCCCC");
					});
					//鼠标移出
					jQuery("#alpriceListTable_data tr").live("mouseout", function() {
					  	jQuery(this).css("background-color","white");
					});
				});
				//重置
				function resetQueryCondition(){
					jQuery("#queryPriceType").val("");
					jQuery("#queryAlpriceDate").val("");
					jQuery("#queryOrderCreate_input").val("");
				}
			</script>
			<style type="text/css">
				
			</style>
		</ui:define>
	    <ui:define name="body">
	    	<h:form id="form" prependId="false">
	    		<div style="white-space:nowrap;width: 100%;overflow:inherit;"> 
	    		<h:panelGrid  columns="5" style="width: 100%" >
					<h:outputLabel for="queryPriceType" value="铝价类型：" />
    				<h:selectOneMenu id="queryPriceType" value="#{alpriceManageAction.queryAlprice.priceType}" style="width: 170px;height:25px;font-size: 17.6px">  
    				 	<f:selectItem itemLabel="请选择"  itemValue=""/>
		                <f:selectItems value="#{alpriceManageAction.alpriceTypeItems}"/>
		            </h:selectOneMenu>
					<h:outputLabel for="queryAlpriceDate" value="铝价日期："/>
    				<p:calendar id="queryAlpriceDate" value="#{alpriceManageAction.queryAlprice.date}" size="15"
    					timeZone="GMT+8" pattern="yyyy-MM-dd" showButtonPanel="true" navigator="true"/>
    				<h:panelGrid columns="4">
	   				    <p:commandButton value="查询" action="#{alpriceManageAction.doFilterAlPriceList}"  update=":form:alpriceListTable"/>
	    				<p:commandButton value="重置" onclick="resetQueryCondition()" />
    				    <p:commandButton value="新增" action="#{alpriceManageAction.addAlPrice}" update=":form:addAlpriceDlgID" oncomplete="addAlpriceDlg.show()"/>
	    			    <p:commandButton value="导入导出"/>
    			    </h:panelGrid>
				</h:panelGrid><p/>
				<p:dataTable id="alpriceListTable" value="#{alpriceManageAction.alpriceList}" var="alprice" rowKey="#{alprice}" emptyMessage="没有铝价！"
	    				paginator="true" rows="10"  	rowsPerPageTemplate="5,10,15"	paginatorAlwaysVisible="false" 	paginatorPosition="bottom" currentPageReportTemplate="查询到{totalRecords}条记录，本页显示{startRecord}～{endRecord}；第{currentPage}/{totalPages}页"
               			paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"   >
               			<f:facet name="header">铝价列表</f:facet>
               			<p:column headerText="铝价日期">
               				<h:outputText value="#{alprice.date}" >
               					<f:convertDateTime pattern="yyyy-MM-dd" timeZone="GMT+8" />
               				</h:outputText>
               			</p:column>
               			<p:column headerText="铝价类型">
               			    <h:selectOneMenu id="priceType" value="#{alprice.priceType}" disabled="true" style="width: 100%" >  
		                        <f:selectItems value="#{alpriceManageAction.alpriceTypeItems}" />
		                    </h:selectOneMenu>
               			</p:column>
               			<p:column headerText="铝价区间"  style="text-align:center;">
               				<h:outputText value="#{alprice.minPrice}"  >
               					<f:convertNumber type="number" pattern="#,###.##" minFractionDigits="2"/>
               				</h:outputText>
               				<h:outputText value="-"  />
               				<h:outputText value="#{alprice.maxPrice}"  >
               					<f:convertNumber type="number" pattern="#,###.##" minFractionDigits="2"/>
               				</h:outputText>
               			</p:column>
               			<p:column headerText="平均铝价"  style="text-align:center;">
               				<h:outputText value="#{alprice.averagePrice}"  >
               					<f:convertNumber type="number" pattern="#,###.##" minFractionDigits="2"/>
               				</h:outputText>
               			</p:column>
               			<p:column headerText="涨跌" style="text-align:center;">
               				<h:outputText value="#{alprice.upAndDown}" />
               			</p:column>
               			<p:column headerText="操作" style="text-align:center;">
               				<p:commandLink value="修改" action="#{alpriceManageAction.setUpdateAlprice(alprice)}" oncomplete="updateAlpriceDlg.show();"
			    				update=":form:updateAlpriceDlgID" style="color:red;margin-right:5px"/>
			    			<p:commandLink value="删除" action="#{alpriceManageAction.setUpdateAlprice(alprice)}" oncomplete="deleteAlpriceDlg.show();"
			    				update=":form:updateAlpriceDlgID,:form:deleteAlpriceDlgID" style="color:red;margin-right:5px"/>
               			</p:column>
               	</p:dataTable>
               	
               	
               	<!-- 新增铝价 -->
               	<p:dialog id="addAlpriceDlgID" header="新增铝价" widgetVar="addAlpriceDlg" modal="true" resizable="true" >
               		<p:outputPanel id="addAlpricePanel"  style="width: 100%" >
              			<table><tr><td>
							<h:outputLabel for="addAlpriceDate" value="铝价日期："/>
						</td><td>
							<p:calendar id="addAlpriceDate" value="#{alpriceManageAction.addAlprice.date}" size="15"
		    					timeZone="GMT+8" pattern="yyyy-MM-dd" showButtonPanel="true" navigator="true"/>
               			</td></tr>
					    <tr><td>
	              			<h:outputLabel for="addAlpriceType" value="铝价类型："/>
	              		</td><td>
               				<h:selectOneMenu id="addAlpriceType" value="#{alpriceManageAction.addAlprice.priceType}" style="font-weight: bold;width:160px" >  
					            <f:selectItems value="#{alpriceManageAction.alpriceTypeItems}"/>
					         </h:selectOneMenu>
					     </td></tr>
					    <tr><td>
               				<h:outputLabel for="addMinprice" value="最低价格："/>
               			</td><td>
					    	<p:inputText id="addMinprice"  value="#{alpriceManageAction.addAlprice.minPrice}"  style="font-weight: bold;width:160px;text-align:right;ime-mode:disabled" 
					    			onfocus="replaceComma(id,value);" onkeyup="checkMoneyOnKeyUp(this.id, this.value, 20, 2)" >
					    		 <f:convertNumber type="number" pattern="#,###.##" minFractionDigits="2"/>
					    	</p:inputText>
					    </td></tr>
					    <tr><td>
               				<h:outputLabel for="addMaxprice" value="最高价格："/>
               			</td><td>
					    	<p:inputText id="addMaxprice"  value="#{alpriceManageAction.addAlprice.maxPrice}"  style="font-weight: bold;width:160px;text-align:right;ime-mode:disabled" 
					    			onfocus="replaceComma(id,value);" onkeyup="checkMoneyOnKeyUp(this.id, this.value, 20, 2)" >
					    		 <f:convertNumber type="number" pattern="#,###.##" minFractionDigits="2"/>
					    	</p:inputText>
					    </td></tr>
					     <tr><td>
               				<h:outputLabel for="addAverageprice" value="平均价格："/>
               			</td><td>
					    	<p:inputText id="addAverageprice"  value="#{alpriceManageAction.addAlprice.averagePrice}"  style="font-weight: bold;width:160px;text-align:right;ime-mode:disabled" 
					    			onfocus="replaceComma(id,value);" onkeyup="checkMoneyOnKeyUp(this.id, this.value, 20, 2)" >
					    		 <f:convertNumber type="number" pattern="#,###.##" minFractionDigits="2"/>
					    	</p:inputText>
					    </td></tr>
					    <tr><td>
               				<h:outputLabel for="addUpanddown" value="涨跌："/>
               			</td><td>
					    	<p:inputText id="addUpanddown"  value="#{alpriceManageAction.addAlprice.upAndDown}"  style="font-weight: bold;width:160px;text-align:right;ime-mode:disabled" 
					    			 onkeyup="checkMoneyOnKeyUp(this.id, this.value, 20, 2)" >
					    		 <f:convertNumber type="number" pattern="#,###.##" minFractionDigits="2"/>
					    	</p:inputText>
						</td></tr></table>
               		</p:outputPanel><p/>
               		
               		<f:facet name="footer">
		    				<p:commandButton value="保存" action="#{alpriceManageAction.saveAlPrice}"  update=":form:alpriceListTable"
		    					oncomplete="if(this.args.error){alert(this.args.error)}else{alert(this.args.msg);addAlpriceDlg.hide();}" />
		    				<p:spacer width="5"/>
		    				<p:commandButton value="关闭" onclick="addAlpriceDlg.hide();" type="button"/>
		    			</f:facet>
               	</p:dialog>
               	
               	<!-- 修改铝价 -->
               	<p:dialog id="updateAlpriceDlgID" header="修改铝价" widgetVar="updateAlpriceDlg" modal="true" resizable="true" >
               		<p:outputPanel id="updateAlpricePanel"  style="width: 100%" >
              			<table><tr><td>
							<h:outputLabel for="updateAlpriceDate" value="铝价日期："/>
						</td><td>
							<p:calendar id="updateAlpriceDate" value="#{alpriceManageAction.updateAlprice.date}" size="15"
		    					timeZone="GMT+8" pattern="yyyy-MM-dd" showButtonPanel="true" navigator="true"/>
               			</td></tr>
					    <tr><td>
	              			<h:outputLabel for="updateAlpriceType" value="铝价类型："/>
	              		</td><td>
               				<h:selectOneMenu id="updateAlpriceType" value="#{alpriceManageAction.updateAlprice.priceType}" style="font-weight: bold;width:160px" >  
					            <f:selectItems value="#{alpriceManageAction.alpriceTypeItems}"/>
					         </h:selectOneMenu>
					     </td></tr>
					    <tr><td>
               				<h:outputLabel for="updateMinprice" value="最低价格："/>
               			</td><td>
					    	<p:inputText id="updateMinprice"  value="#{alpriceManageAction.updateAlprice.minPrice}"  style="font-weight: bold;width:160px;text-align:right;ime-mode:disabled" 
					    			onfocus="replaceComma(id,value);" onkeyup="checkMoneyOnKeyUp(this.id, this.value, 20, 2)" >
					    		 <f:convertNumber type="number" pattern="#,###.##" minFractionDigits="2"/>
					    	</p:inputText>
					    </td></tr>
					    <tr><td>
               				<h:outputLabel for="updateMaxprice" value="最高价格："/>
               			</td><td>
					    	<p:inputText id="updateMaxprice"  value="#{alpriceManageAction.updateAlprice.maxPrice}"  style="font-weight: bold;width:160px;text-align:right;ime-mode:disabled" 
					    			onfocus="replaceComma(id,value);" onkeyup="checkMoneyOnKeyUp(this.id, this.value, 20, 2)" >
					    		 <f:convertNumber type="number" pattern="#,###.##" minFractionDigits="2"/>
					    	</p:inputText>
					    </td></tr>
					     <tr><td>
               				<h:outputLabel for="updateAverageprice" value="平均价格："/>
               			</td><td>
					    	<p:inputText id="updateAverageprice"  value="#{alpriceManageAction.updateAlprice.averagePrice}"  style="font-weight: bold;width:160px;text-align:right;ime-mode:disabled" 
					    			onfocus="replaceComma(id,value);" onkeyup="checkMoneyOnKeyUp(this.id, this.value, 20, 2)" >
					    		 <f:convertNumber type="number" pattern="#,###.##" minFractionDigits="2"/>
					    	</p:inputText>
					    </td></tr>
					    <tr><td>
               				<h:outputLabel for="updateUpanddown" value="涨跌："/>
               			</td><td>
					    	<p:inputText id="updateUpanddown"  value="#{alpriceManageAction.updateAlprice.upAndDown}"  style="font-weight: bold;width:160px;text-align:right;ime-mode:disabled" 
					    			 onkeyup="checkMoneyOnKeyUp(this.id, this.value, 20, 2)" >
					    		 <f:convertNumber type="number" pattern="#,###.##" minFractionDigits="2"/>
					    	</p:inputText>
						</td></tr></table>
               		</p:outputPanel><p/>
               		
               		<f:facet name="footer">
		    			<p:commandButton value="更新" action="#{alpriceManageAction.updateAlPrice}"  update=":form:alpriceListTable"
		    				oncomplete="if(this.args.error){alert(this.args.error)}else{alert(this.args.msg);updateAlpriceDlg.hide();}" />
		    			<p:spacer width="5"/>
		    			<p:commandButton value="关闭" onclick="updateAlpriceDlg.hide();" type="button"/>
		    		</f:facet>
               	</p:dialog>
               	
               	<!-- 删除铝价 -->
				<p:confirmDialog id="deleteAlpriceDlgID" message="确认删除铝价吗?"
					header="删除铝价" severity="alert" widgetVar="deleteAlpriceDlg">
					<p:commandButton value="确定" update=":form:alpriceListTable" action="#{alpriceManageAction.deleteAlPrice}"
						oncomplete="if(this.args.error){alert(this.args.error)}else{alert(this.args.msg);deleteAlpriceDlg.hide();}"  />
					<p:commandButton value="取消" onclick="deleteAlpriceDlg.hide()" type="button" />
				</p:confirmDialog>
               	</div>
			</h:form>
	    </ui:define>
		</ui:composition>
	</body>
</html>
